<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/jquery-3.6.0.js"></script>
    <style>
        div {
            width: 200px;
            height: 200px;
            background-color: blue;
        }
    </style>
</head>
<body>
    <form name="myform">
        <p>速度</p>
        <input type="radio" name="speed" value="slow"> slow
        <input type="radio" name="speed" value="normal"> normal
        <input type="radio" name="speed" value="fast"> fast
        <input type="number">ms
        <br>
        <p>动画效果</p>
        <input type="radio" name="easing" value="swing"> swing
        <input type="radio" name="easing" value="linear"> linear
    </form>
    <p></p>
    <button data-type="slideDown">滑入</button>
    <button data-type="slideUp">滑出</button>
    <button data-type="slideToggle">滑动</button>
        <p></p>
    <div class="box"></div>
    <script>
        $('button').click(function() {
            let type = this.dataset.type;
            let elements = document.forms.myform.elements;
            console.log(elements.speed);
            console.log(elements.easing);
            let speed = elements.speed.value;
            let easing = elements.easing.value;

            if (type === 'slideDown') {
                $('div').slideDown(speed, easing)
            } else if (type === 'slideUp') {
                $('div').slideUp(speed, easing)
            } else {
                $('div').slideToggle(speed, easing)
            }
        })
    </script>
</body>
</html>